package array.simple;

public class TeemoAttacking_495 {

    public int findPoisonedDuration(int[] timeSeries, int duration) {
        int ant = duration;
        for (int i = 1; i < timeSeries.length; i++) {
            ant += Math.min(duration, timeSeries[i] - timeSeries[i - 1]);
        }
        return ant;
    }

    public static void main(String[] args) {
        TeemoAttacking_495 ta = new TeemoAttacking_495();
        System.out.println(ta.findPoisonedDuration(new int[]{1, 2}, 2));
    }
}
